<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>获取焦点</title>
    <script src="https://cdn.jsdelivr.net/npm/vue"></script>
    <style>
        input:focus{
            background-color: coral;
        }
    </style>
</head>

<body>
<div id="app">
<div>页面载入时，自动获取焦点</div>
<input v-circle />
</div>


<script>

    // 注册一个全局自定义指令 v-focus
    Vue.directive('circle', function (el,bind) {
        //不需要钩子函数，简写
        el.style="border-radius: 50%;background-color: coral;width: 100px;height: 100px";

    })

    var v = new Vue({
        el: '#app',


    })


</script>

</body>
</html>